package com.britoso;

import java.io.File;
import java.io.FilenameFilter;

final class FileFilter implements FilenameFilter 
{
	private final static String[] extensions = {".avi",".mkv",".mp4",".rmvb",".flv",".webp",".mpg",".mpeg",".mov","rar","wma"}; 
	@Override
	public boolean accept(File dir, String name) 
	{
		File testFile= new File(dir.getAbsolutePath()+System.getProperty("file.separator")+name);
		if(testFile.isDirectory())
			return true;
		
	    for(int i=0;i<extensions.length;i++)
	    {
	    	if(name.endsWith(extensions[i]))
	    		return true;
	    }
	    
	    if(testFile.length() > 10485760l)//10MB
	    {
	    	//System.err.println("File "+testFile.getAbsoluteFile() +" found but does not meet extension filter.");
	    }
	    return false;
	}
}